package cn.lanqiao.web.controller;

import cn.lanqiao.common.utile.Result;
import cn.lanqiao.common.vo.FilmVo;
import cn.lanqiao.system.service.TypeService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/type")
@CrossOrigin
public class TypeController {
    @Autowired
    private TypeService typeService;
    @RequestMapping("/findByTypeName")
    public Result findByTypeName(@Param("typeName") String typeName){
        System.out.println("电影类型名称："+typeName);
        try {
            List<FilmVo> list=typeService.findByTypeName(typeName);
            return Result.ok(list);
        }catch (Exception e){
            e.printStackTrace();
        }
        return Result.fail("系统错误!");
    }
}
